home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / cmds.fmt / egrep.man < prev    next >
Encoding:
Text File  |  1989-01-26  |  5.4 KB  |  199 lines

  1.  
  2.  
  3.  
  4. GREP                      User Commands                      GREP
  5.  
  6.  
  7.  
  8. NNAAMMEE
  9.      grep, egrep, fgrep - search a file for a pattern
  10.  
  11. SSYYNNOOPPSSIISS
  12.      ggrreepp [ option ] ...  expression [ file ] ...
  13.  
  14.      eeggrreepp [ option ] ...  [ expression ] [ file ] ...
  15.  
  16.      ffggrreepp [ option ] ...  [ strings ] [ file ]
  17.  
  18. DDEESSCCRRIIPPTTIIOONN
  19.      Commands of the _g_r_e_p family search the input _f_i_l_e_s (standard
  20.      input default) for lines matching a pattern.  Normally, each
  21.      line found is copied to the standard output.  _G_r_e_p patterns
  22.      are limited regular expressions in the style of _e_x(1); it
  23.      uses a compact nondeterministic algorithm.  _E_g_r_e_p patterns
  24.      are full regular expressions; it uses a fast deterministic
  25.      algorithm that sometimes needs exponential space.  _F_g_r_e_p
  26.      patterns are fixed strings; it is fast and compact.  The
  27.      following options are recognized.
  28.  
  29.      --vv   All lines but those matching are printed.
  30.  
  31.      --xx   (Exact) only lines matched in their entirety are
  32.           printed (_f_g_r_e_p only).
  33.  
  34.      --cc   Only a count of matching lines is printed.
  35.  
  36.      --ll   The names of files with matching lines are listed
  37.           (once) separated by newlines.
  38.  
  39.      --nn   Each line is preceded by its relative line number in
  40.           the file.
  41.  
  42.      --bb   Each line is preceded by the block number on which it
  43.           was found.  This is sometimes useful in locating disk
  44.           block numbers by context.
  45.  
  46.      --hh   Never print filename headers with output lines.
  47.  
  48.      --oo   Always print filename headers with output lines.
  49.  
  50.      --ii   The case of letters is ignored in making comparisons -
  51.           that is, upper and lower case are considered identical.
  52.  
  53.      --ss   Silent mode.  Nothing is printed (except error mes-
  54.           sages).  This is useful for checking the error status.
  55.  
  56.      --ww   The expression is searched for as a word (as if sur-
  57.           rounded by `\<' and `\>', see _e_x(1).) (_g_r_e_p only)
  58.  
  59.      --ee _e_x_p_r_e_s_s_i_o_n
  60.  
  61.  
  62.  
  63. Sprite v1.0              October 8, 1987                        1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. GREP                      User Commands                      GREP
  71.  
  72.  
  73.  
  74.           Same as a simple _e_x_p_r_e_s_s_i_o_n argument, but useful when
  75.           the _e_x_p_r_e_s_s_i_o_n begins with a -.
  76.  
  77.      --ff _f_i_l_e
  78.           The regular expression (_e_g_r_e_p) or string list (_f_g_r_e_p)
  79.           is taken from the _f_i_l_e.
  80.  
  81.      In all cases the file name is shown if there is more than
  82.      one input file.  Care should be taken when using the charac-
  83.      ters $ * [ ^ | ( ) and \ in the _e_x_p_r_e_s_s_i_o_n as they are also
  84.      meaningful to the Shell.  It is safest to enclose the entire
  85.      _e_x_p_r_e_s_s_i_o_n argument in single quotes ' '.
  86.  
  87.      _F_g_r_e_p searches for lines that contain one of the (newline-
  88.      separated) _s_t_r_i_n_g_s.
  89.  
  90.      _E_g_r_e_p accepts extended regular expressions.  In the follow-
  91.      ing description `character' excludes newline:
  92.  
  93.           A \ followed by a single character other than newline
  94.           matches that character.
  95.  
  96.           The character ^ matches the beginning of a line.
  97.  
  98.           The character $ matches the end of a line.
  99.  
  100.           A .. (period) matches any character.
  101.  
  102.           A single character not otherwise endowed with special
  103.           meaning matches that character.
  104.  
  105.           A string enclosed in brackets [] matches any single
  106.           character from the string.  Ranges of ASCII character
  107.           codes may be abbreviated as in `a-z0-9'.  A ] may occur
  108.           only as the first character of the string.  A literal -
  109.           must be placed where it can't be mistaken as a range
  110.           indicator.
  111.  
  112.           A regular expression followed by an * (asterisk)
  113.           matches a sequence of 0 or more matches of the regular
  114.           expression.  A regular expression followed by a +
  115.           (plus) matches a sequence of 1 or more matches of the
  116.           regular expression.  A regular expression followed by a
  117.           ? (question mark) matches a sequence of 0 or 1 matches
  118.           of the regular expression.
  119.  
  120.           Two regular expressions concatenated match a match of
  121.           the first followed by a match of the second.
  122.  
  123.           Two regular expressions separated by | or newline match
  124.           either a match for the first or a match for the second.
  125.  
  126.  
  127.  
  128.  
  129. Sprite v1.0              October 8, 1987                        2
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. GREP                      User Commands                      GREP
  137.  
  138.  
  139.  
  140.           A regular expression enclosed in parentheses matches a
  141.           match for the regular expression.
  142.  
  143.      The order of precedence of operators at the same parenthesis
  144.      level is [] then *+? then concatenation then | and newline.
  145.  
  146.      Ideally there should be only one _g_r_e_p, but we don't know a
  147.      single algorithm that spans a wide enough range of space-
  148.      time tradeoffs.
  149.  
  150. SSEEEE AALLSSOO
  151.      ex(1), sed(1), sh(1)
  152.  
  153. DDIIAAGGNNOOSSTTIICCSS
  154.      Exit status is 0 if any matches are found, 1 if none, 2 for
  155.      syntax errors or inaccessible files.
  156.  
  157. BBUUGGSS
  158.      Lines are limited to 256 characters; longer lines are trun-
  159.      cated.
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195. Sprite v1.0              October 8, 1987                        3
  196.  
  197.  
  198.  
  199.